<?php  if ( ! defined('BASEPATH')) exit('No direct script access allowed');
class Ajax extends CI_Controller {	
    public function __construct()
    {
        parent::__construct();
    }
	
    public function index()
    {
		show_404();
    }
	
	public function harian($date1, $date2, $tipe, $filter=false)
	{
		if($date1==null or $date2==null or $tipe==null)
			show_404();
		$sql = "CALL `VIEW_PRODUKSI_HARIAN`('$date1', '$date2', '$tipe', '$filter')";
		$query = $this->db->query($sql);
		$result = $query->result();
		$this->output->set_content_type('application/json');
		$this->output->set_output(json_encode($result));
	}
	
	public function stock($tipe)
	{
		$sql = "select jumlah from stock where tipe='$tipe'";
		$query = $this->db->query($sql);
		$result = $query->result();
		$this->output->set_output(intval($result[0]->jumlah));
		//$this->output->set_content_type('application/json');
		//$this->output->set_output(json_encode($result));
	}
}
/* End of Ajax */
/* 05 Februari 2014 [01:33 PM] */